<!DOCTYPE html>
<html lang="en">

<head>
    <link href="${ctx}/resources/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/resources/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx}/resources/css/plugins/dataTables/dataTables.bootstrap.css?v=1.4.0" rel="stylesheet"/>
    <link href="${ctx}/resources/css/animate.min.css" rel="stylesheet">
    <link href="${ctx}/resources/css/style.min.css?v=4.1.1" rel="stylesheet">
    <link href="${ctx}/resources/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctx}/resources/js/plugins/nicevalidator/dist/jquery.validator.css" rel="stylesheet">
</head>
<body class="gray-bg">
<form id="inputForm" name="inputForm" action="${ctx}/admin/sys/menu/saveAndUpdate" method="post" class="form-horizontal"
      data-validator-option="{stopOnError:true,timely:2, theme:'yellow_top'}">
    <input type="hidden" name="id" value="${menu.id}"/>
    <table class="table table-bordered  table-condensed dataTable no-footer">
        <tbody>
        <tr>
            <td class="width-15 active"><label class="pull-right">上级菜单:</label></td>
            <td class="width-35">
                <input id="parentId" name="parentId" class="form-control" type="hidden" data-rule="required;"
                       value="${menu.parentId}"/>
                <div class="input-group">
                    <input id="parentName" name="parentMenu.menuName" readonly="readonly" type="text"
                           value="${menu.parentMenu.menuName}"
                           class="form-control" data-rule="required;"/>
                    <span class="input-group-btn">
                     <button type="button" id="parentButton" class="btn btn-primary"><i
                             class="fa fa-search"></i></button>
       		        </span>
                </div>
            </td>
            <td class="width-15 active"><label class="pull-right"><font color="red">*</font> 名称:</label></td>
            <td class="width-35"><input id="menuName" name="menuName" maxlength="50" class="form-control"
                                        data-rule="required;"
                                        value="${menu.menuName}"/></td>
        </tr>
        <tr>
            <td class="width-15 active"><label class="pull-right">链接:</label></td>
            <td class="width-35"><input name="menuHref" maxlength="200" class="form-control "
                                        value="${menu.menuHref}"/>
                <span class="help-inline">点击菜单跳转的页面</span></td>
            <td class="width-15 active"><label class="pull-right">图标:</label></td>
            <td class="width-35">
                <i id="iconIcon" class="fa fa-${menu.menuIcon}"></i>&nbsp;
                <span id="menuIconLabel">${menu.menuIcon}</span>&nbsp;
                <input id="menuIcon" name="menuIcon" type="hidden" value="${menu.menuIcon}">
                <a id="menuIconButton" href="javascript:" onclick="openIconDialog('选择图标','${ctx}/admin/sys/menu/menuIcon?icon=${menu.menuIcon}')" class="btn btn-primary">选择</a>&nbsp;&nbsp;
                <input id="menuIconClear" class="btn btn-default" type="button" value="清除" onclick="clear()"/>
            </td>
        </tr>
        <tr>
            <td class="width-15 active"><label class="pull-right">可见:</label></td>
            <td class="width-35">
                <span class="help-inline">该菜单或操作是否显示到系统菜单中</span></td>
            <td class="width-15 active"><label class="pull-right">排序:</label></td>
            <td class="width-35"><input type="text" name="menuSort" maxlength="50" class="form-control"
                                        data-rule="required;integer(+)"
                                        value="${menu.menuSort}"/>
                <span class="help-inline">排列顺序，升序。</span></td>
        </tr>
        <tr>
            <td class="width-15 active"><label class="pull-right">权限标识:</label></td>
            <td class="width-35"><input type="text" name="permission" maxlength="100" class="form-control "
                                        value="${menu.permission}"/>
                <span class="help-inline">控制器中定义的权限标识，如：@RequiresPermissions("权限标识")</span></td>
            <td class="width-15 active"><label class="pull-right">备注:</label></td>
            <td class="width-35"><textarea name="remarks" rows="3" maxlength="200"
                                           class="form-control ">${menu.remarks}</textarea></td>
        </tr>
        </tbody>
    </table>
</form>

<script src="${ctx}/resources/js/jquery.min.js"></script>
<script src="${ctx}/resources/js/bootstrap.min.js"></script>
<script src="${ctx}/resources/js/plugins/layer/layer/layer.js"></script>
<script src="${ctx}/resources/js/plugins/pace/pace.min.js"></script>
<script src="${ctx}/resources/js/plugins/iCheck/icheck.min.js"></script>
<script src="${ctx}/resources/js/jhook.js?v=201751866" id="jhook" data-context="${ctx}"></script>
<script src="${ctx}/resources/js/menuForm.js?v=20175156r3"></script>
<script src="${ctx}/resources/js/dialog.js?v=2017514"></script>
<script src="${ctx}/resources/js/plugins/nicevalidator/dist/jquery.validator.js?local=zh-CN"
        type="text/javascript"></script>

<script type="text/javascript">
    function doSubmit() {//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
        if ($("#inputForm").isValid()) {
            $.ajax({
                url: "${ctx}/admin/sys/menu/saveAndUpdate",
                data: $("#inputForm").serialize(),
                type: "POST",
                dataType: 'json',
                success: function (result) {
                    if (result.success) {
                        top.layer.alert('提交成功', {icon: 6});
                        return;
                    }
                    top.layer.alert('提交失败', {icon: 5});
                    return;
                },
                error: function () {
                    top.layer.alert('提交失败', {icon: 3});
                    return;
                }
            });
            return true;
        }
        return false;
    }
</script>
</body>
</html>